﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace WCF
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract]
    public interface IWCF
    {
        [OperationContract]
        UserComposite GetUser(Guid ID);
        [OperationContract]
        bool AddUser(Guid UserID, string Username, string Image, string Firstname, string Lastname, string Gender, int Age, string Information);
        [OperationContract]
        bool UpdateFirstname(Guid ID,string firstname);
        [OperationContract]
        bool UpdateLastname(Guid ID, string lastname);
        [OperationContract]
        bool UpdateGender(Guid ID, string gender);
        [OperationContract]
        bool UpdateAge(Guid ID, int age);
        [OperationContract]
        bool UpdateImage(Guid ID, string img);
        [OperationContract]
        bool UpdateInformation(Guid ID, string info);
        [OperationContract]
        List<UserComposite> getUsersByUsername(string username);
        [OperationContract]
        List<UserComposite> getUsersByFirstname(string firstname);
        [OperationContract]
        List<UserComposite> getUsersByLastname(string lastname);
        [OperationContract]
        bool isFriends(Guid firstUserID, Guid secondUserID);
        [OperationContract]
        bool becomeFriends(Guid firstUserID, Guid secondUserID);
        [OperationContract]
        bool deleteFriend(Guid firstUserID, Guid secondUserID);
        [OperationContract]
        List<UserComposite> getFriends(Guid loggedInUser);
        [OperationContract]
        bool sendMessage(MessageComposite message);
        [OperationContract]
        MessageComposite getMessage(Guid messageID);
        [OperationContract]
        List<MessageComposite> getMessages(Guid loggedInUser);
        [OperationContract]
        int messageAmount(Guid loggedInUser);
        [OperationContract]
        List<WallComposite> getWallPosts(Guid userID);
        [OperationContract]
        bool postOnWall(WallComposite postC);
    }


    // Use a data contract as illustrated in the sample below to add composite types to service operations.
     [DataContract]
    public class UserComposite
    {
        [DataMember]
        public Guid UserID { get; set; }
        [DataMember]
        public string Username { get; set; }
        [DataMember]
        public string Image { get; set; }
        [DataMember]
        public string Firstname { get; set; }
        [DataMember]
        public string Lastname { get; set; }
        [DataMember]
        public string Gender { get; set; }
        [DataMember]
        public int Age { get; set; }
        [DataMember]
        public string Information { get; set; }
    }
    [DataContract]
    public class FriendshipComposite
    {
        [DataMember]
        public Guid UserID { get; set; }
        [DataMember]
        public Guid FriendID { get; set; }
        [DataMember]
        public string RelationshipID { get; set; }

    }
    [DataContract]
    public class MessageComposite
    {
        [DataMember]
        public Guid MessageID { get; set; }
        [DataMember]
        public string Message { get; set; }
        [DataMember]
        public string Sentdate { get; set; }
        [DataMember]
        public Guid Sender { get; set; }
        [DataMember]
        public Guid Recepient { get; set; }
        [DataMember]
        public bool Viewed { get; set; }
    }
    public class WallComposite
    {
        [DataMember]
        public Guid MessageID { get; set; }
        [DataMember]
        public string Title { get; set; }
        [DataMember]
        public string Message { get; set; }
        [DataMember]
        public string SentDate { get; set; }
        [DataMember]
        public Guid Sender { get; set; }
        [DataMember]
        public Guid Recepient { get; set; }
    }

}
